//
//  YFNetError.h
//  CoollangTennisBall
//
//  Created by Coollang on 2018/1/12.
//  Copyright © 2018年 Coollang-YF. All rights reserved.
//

#import <Foundation/Foundation.h>


typedef NS_ENUM(NSInteger,WebRespondType) {
    
    WebRespondTypeArgumentError = -2,      // 参数错误
    
    WebRespondTypeOther = -95,             //未知错误
    WebRespondTypeNotReachable = -96,      //网络未连接
    
    WebRespondTypeEmailInvalid = -10001,    //email参数错误
    WebRespondTypePasswordInvalid = -10002, //密码格式不正确
    WebRespondTypeNotLogin = -10003,        // 登录失效
    
    WebRespondTypeServiceError = 500,       // 500错误| 404错误
    WebRespondTypeServiceError404 = 404,    //404错误
    WebRespondTypeSuccess = 0,                  //数据获取成功
    WebRespondTypeSuccess200 = 200,
    
};


@interface YFNetError : NSError

+ (NSError *)creatErrorWithRet:(WebRespondType)ret;

/*
 * retStr服务器返回的状态码
 */
+ (WebRespondType)WebRespondTypeWithRet:(NSString *)retStr;

@end

@interface NSError (MessageUtils)

+ (NSError *)errorWithDomain:(NSString *)aDomain code:(NSInteger)aCode;

+ (NSError *)errorWithDomain:(NSString *)aDomain                        code:(NSInteger)aCode localizedDescription:(NSString *)aDescription;
- (NSString *)errorMessage;

@end

